package com.portal.innovation.sysController;


import com.portal.innovation.common.R;
import com.portal.innovation.pojo.Tags;
import com.portal.innovation.service.TagsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("tags")
public class TagsController {

    @Autowired
    private TagsService tagsService;

    @PostMapping("listAll")
    public R save() {
        List<Tags> dataAll = tagsService.list();
        return R.ok().put("data", dataAll);
    }

    @PostMapping("save")
    public R save(@RequestBody Tags tags) {
        tagsService.save(tags);
        return R.ok();
    }

    @DeleteMapping("delete")
    public R save(@RequestBody Integer[] ids) {
        tagsService.removeTagByIds(Arrays.asList(ids));
        return R.ok();
    }

}
